package com.nCovInfo.util;

import com.nCovInfo.pojo.User;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

import java.io.*;
import java.util.ArrayList;
import java.util.List;

/**
 * 读取文件数据工具类
 * @author ouyang
 * @time 2021-07-25 11:49
 */
@Configuration
public class FileUtils {


    //用户登录成功以后，利用这个方法来
    public  List<User> getUserInfo() throws IOException {
        Resource resource = new ClassPathResource("user.json");
        InputStream is = resource.getInputStream();
        InputStreamReader isr = new InputStreamReader(is);
        BufferedReader br = new BufferedReader(isr);
        String lineTxt = null;
        while ((lineTxt = br.readLine()) != null) {
            System.out.println(lineTxt);
        }
        br.close();
        isr.close();
        is.close();
        return new ArrayList<>();
    }

}
